{"ast":null,"code":"import _objectSpread from\"/Users/iliyagladkov/to-do-react/node_modules/@babel/runtime/helpers/esm/objectSpread2.js\";import _slicedToArray from\"/Users/iliyagladkov/to-do-react/node_modules/@babel/runtime/helpers/esm/slicedToArray.js\";import React,{useState}from'react';import MyInput from'../input/MyInput';import MyButtonAdd from'../MyButton/MyButtonAdd/MyButtonAdd';import cl from'./ToDoForm.module.css';import{jsx as _jsx}from\"react/jsx-runtime\";import{jsxs as _jsxs}from\"react/jsx-runtime\";export default function ToDoForm(_ref){var create=_ref.create;var _useState=useState({title:'',body:''}),_useState2=_slicedToArray(_useState,2),toDoItem=_useState2[0],setToDoItem=_useState2[1];function addNewToDo(e){e.preventDefault();var newToDo=_objectSpread(_objectSpread({},toDoItem),{},{id:Date.now()});create(newToDo);setToDoItem({title:'',body:''});}return/*#__PURE__*/_jsxs(\"form\",{className:cl.myForm,children:[/*#__PURE__*/_jsx(\"h1\",{className:cl.headerAdd,children:\"New to-do\"}),/*#__PURE__*/_jsx(MyInput,{value:toDoItem.title,onChange:function onChange(e){return setToDoItem(_objectSpread(_objectSpread({},toDoItem),{},{title:e.target.value}));},type:\"text\",placeholder:\"This is title...\"}),/*#__PURE__*/_jsx(MyInput,{value:toDoItem.body,onChange:function onChange(e){return setToDoItem(_objectSpread(_objectSpread({},toDoItem),{},{body:e.target.value}));},type:\"text\",placeholder:\"This is description...\"}),/*#__PURE__*/_jsx(MyButtonAdd,{onClick:addNewToDo})]});}","map":{"version":3,"names":["React","useState","MyInput","MyButtonAdd","cl","ToDoForm","create","title","body","toDoItem","setToDoItem","addNewToDo","e","preventDefault","newToDo","id","Date","now","myForm","headerAdd","target","value"],"sources":["/Users/iliyagladkov/to-do-react/src/components/UI/forms/ToDoForm.jsx"],"sourcesContent":["import React, { useState } from 'react'\nimport MyInput from '../input/MyInput'\nimport MyButtonAdd from '../MyButton/MyButtonAdd/MyButtonAdd'\nimport cl from './ToDoForm.module.css'\n\nexport default function ToDoForm({create}) {\n    const [toDoItem, setToDoItem] = useState({title: '', body: ''})\n\n    function addNewToDo(e) {\n        e.preventDefault()\n    \n        const newToDo = {\n            ...toDoItem, id: Date.now()\n        }\n        create(newToDo)\n        setToDoItem({title: '', body: ''})\n    }\n\n    return (\n        <form className={cl.myForm}>\n            <h1 className={cl.headerAdd}>New to-do</h1>\n            <MyInput\n                value={toDoItem.title}\n                onChange={e => setToDoItem({...toDoItem, title: e.target.value})}\n                type=\"text\"\n                placeholder='This is title...'\n            />\n            <MyInput\n                value={toDoItem.body}\n                onChange={e => setToDoItem({...toDoItem, body: e.target.value})}\n                type=\"text\"\n                placeholder='This is description...'\n            />\n            <MyButtonAdd onClick={addNewToDo}></MyButtonAdd>\n        </form>\n    )\n}\n"],"mappings":"yOAAA,MAAOA,MAAK,EAAIC,QAAQ,KAAQ,OAAO,CACvC,MAAOC,QAAO,KAAM,kBAAkB,CACtC,MAAOC,YAAW,KAAM,qCAAqC,CAC7D,MAAOC,GAAE,KAAM,uBAAuB,yFAEtC,cAAe,SAASC,SAAQ,MAAW,IAATC,OAAM,MAANA,MAAM,CACpC,cAAgCL,QAAQ,CAAC,CAACM,KAAK,CAAE,EAAE,CAAEC,IAAI,CAAE,EAAE,CAAC,CAAC,wCAAxDC,QAAQ,eAAEC,WAAW,eAE5B,QAASC,WAAU,CAACC,CAAC,CAAE,CACnBA,CAAC,CAACC,cAAc,EAAE,CAElB,GAAMC,QAAO,gCACNL,QAAQ,MAAEM,EAAE,CAAEC,IAAI,CAACC,GAAG,EAAE,EAC9B,CACDX,MAAM,CAACQ,OAAO,CAAC,CACfJ,WAAW,CAAC,CAACH,KAAK,CAAE,EAAE,CAAEC,IAAI,CAAE,EAAE,CAAC,CAAC,CACtC,CAEA,mBACI,cAAM,SAAS,CAAEJ,EAAE,CAACc,MAAO,wBACvB,WAAI,SAAS,CAAEd,EAAE,CAACe,SAAU,UAAC,WAAS,EAAK,cAC3C,KAAC,OAAO,EACJ,KAAK,CAAEV,QAAQ,CAACF,KAAM,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